package de.fhkl.strokeprotocol.messages;

/**
 * Message that informs the receiver that the sender is still there.
 */
public class PingMessage implements IMessage
{
	private static final long serialVersionUID = -6345356411782729232L;

	/**
	 * The server uses this flag to inform clients whether there are other
	 * contacts available that might possibly receive messages.
	 */
	private boolean mIsReceiverAvailable;

	/**
	 * Message that informs the receiver that the sender is still there. Sets
	 * the isReceiverAvailable flag to false.
	 */
	public PingMessage()
	{
		this(false);
	}

	/**
	 * Message that informs the receiver that the sender is still there.
	 * 
	 * @param isReceiverAvailable
	 */
	public PingMessage(boolean isReceiverAvailable)
	{
		mIsReceiverAvailable = isReceiverAvailable;
	}

	/**
	 * Returns the flag whether there are other contacts available that might
	 * possibly receive messages.
	 * 
	 * @return
	 */
	public boolean isReceiverAvailable()
	{
		return mIsReceiverAvailable;
	}

	/**
	 * Sets the flag to inform clients whether there are other contacts
	 * available that might possibly receive messages.
	 * 
	 * @param isReceiverAvailable
	 */
	public void setReceiverAvailable(boolean isReceiverAvailable)
	{
		mIsReceiverAvailable = isReceiverAvailable;
	}
}
